/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.uniminuto.edu.gimnasioInteligente.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author diegoalejandro
 */
@Entity
@Table(name = "medida")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Medida.findAll", query = "SELECT m FROM Medida m"),
    @NamedQuery(name = "Medida.findByIdMedida", query = "SELECT m FROM Medida m WHERE m.idMedida = :idMedida"),
    @NamedQuery(name = "Medida.findByPeso", query = "SELECT m FROM Medida m WHERE m.peso = :peso"),
    @NamedQuery(name = "Medida.findByPresionSanguinea", query = "SELECT m FROM Medida m WHERE m.presionSanguinea = :presionSanguinea"),
    @NamedQuery(name = "Medida.findByRitmoCardiaco", query = "SELECT m FROM Medida m WHERE m.ritmoCardiaco = :ritmoCardiaco"),
    @NamedQuery(name = "Medida.findByCintura", query = "SELECT m FROM Medida m WHERE m.cintura = :cintura"),
    @NamedQuery(name = "Medida.findByPiernas", query = "SELECT m FROM Medida m WHERE m.piernas = :piernas"),
    @NamedQuery(name = "Medida.findByBrazos", query = "SELECT m FROM Medida m WHERE m.brazos = :brazos")})
public class Medida implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idMedida")
    private Integer idMedida;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "peso")
    private Double peso;
    @Column(name = "presionSanguinea")
    private Double presionSanguinea;
    @Column(name = "ritmoCardiaco")
    private Integer ritmoCardiaco;
    @Column(name = "cintura")
    private Double cintura;
    @Column(name = "piernas")
    private Double piernas;
    @Column(name = "brazos")
    private Double brazos;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "medidaidMedida")
    private Collection<HistoricoMedidas> historicoMedidasCollection;

    public Medida() {
    }

    public Medida(Integer idMedida) {
        this.idMedida = idMedida;
    }

    public Integer getIdMedida() {
        return idMedida;
    }

    public void setIdMedida(Integer idMedida) {
        this.idMedida = idMedida;
    }

    public Double getPeso() {
        return peso;
    }

    public void setPeso(Double peso) {
        this.peso = peso;
    }

    public Double getPresionSanguinea() {
        return presionSanguinea;
    }

    public void setPresionSanguinea(Double presionSanguinea) {
        this.presionSanguinea = presionSanguinea;
    }

    public Integer getRitmoCardiaco() {
        return ritmoCardiaco;
    }

    public void setRitmoCardiaco(Integer ritmoCardiaco) {
        this.ritmoCardiaco = ritmoCardiaco;
    }

    public Double getCintura() {
        return cintura;
    }

    public void setCintura(Double cintura) {
        this.cintura = cintura;
    }

    public Double getPiernas() {
        return piernas;
    }

    public void setPiernas(Double piernas) {
        this.piernas = piernas;
    }

    public Double getBrazos() {
        return brazos;
    }

    public void setBrazos(Double brazos) {
        this.brazos = brazos;
    }

    @XmlTransient
    public Collection<HistoricoMedidas> getHistoricoMedidasCollection() {
        return historicoMedidasCollection;
    }

    public void setHistoricoMedidasCollection(Collection<HistoricoMedidas> historicoMedidasCollection) {
        this.historicoMedidasCollection = historicoMedidasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMedida != null ? idMedida.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Medida)) {
            return false;
        }
        Medida other = (Medida) object;
        if ((this.idMedida == null && other.idMedida != null) || (this.idMedida != null && !this.idMedida.equals(other.idMedida))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.uniminuto.edu.gimnasioInteligente.entities.Medida[ idMedida=" + idMedida + " ]";
    }
    
}
